import * as OSS from 'ali-oss';
export class AliOSS {
    private accessKeyId = 'LTAI4FtytKKbudrdJsYig3HM';
    private accessKeySecret = 'BGNoom8RrBKHkyhu5INiLFSTgtHLR4';
    private client;
    constructor() {
        this.client = new OSS({
            region: 'oss-cn-qingdao',
            accessKeyId: this.accessKeyId,
            accessKeySecret: this.accessKeySecret,
            bucket: 'coeus'
        });
    }

    async put(key: string, filePath: string) {
        try {
            await this.client.putBucketACL('coeus', 'public-read');
            let result = await this.client.put(key, filePath);
            console.log(result.url);
            return result.url;
        } catch (error) {
            console.error(error);
            throw error;
        }
    }
}